﻿using HslCommunication.Profinet.Siemens;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoneLineNew.Enums;
using ZoneLineNew.Models;
using ZoneLineNew.Models.Entity.StationResult;

namespace ZoneLineNew.Services.Station {

    /// <summary>
    /// 工站服务接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IWorkStationService<T, T2> where T : StationResultBase where T2 : StationConfigBase {

        /// <summary>
        /// 当前站点名称
        /// </summary>
        string CurrentStationName { get; }

        /// <summary>
        /// 连接状态
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// Ip
        /// </summary>
        string IP { get; }

        /// <summary>
        /// 端口
        /// </summary>
        int Prot { get; }

        /// <summary>
        /// 站点配置
        /// </summary>
        T2 StationConfig { get; }

        /// <summary>
        /// 保存数据
        /// </summary>
        T StationRecordData { get; }

        /// <summary>
        /// 当前序号
        /// </summary>
        int CurrentLableIndex { get; }

        bool StartUploadCode { get; }

        bool StartUploadData { get;  }

        bool EndUpLoadCode { get;  }

        bool EndUpLoadData { get;}

        int AllowWork { get; }

        /// <summary>
        /// 设备连接
        /// </summary>
        /// <returns></returns>
        bool Connect();

        /// <summary>
        /// 获取客户端对象
        /// </summary>
        /// <returns></returns>
        SiemensS7Net GetSiemensS7Client();

        /// <summary>
        /// 获取当前工站流水号
        /// </summary>
        /// <param name="ePrintStartionCode"></param>
        /// <returns></returns>
        int GetCurrentLableIndex(ePrintStartionCode ePrintStartionCode);

        /// <summary>
        /// 处理公共数据，主要是控制请求信号（心跳、扫码防错、数据保存、加工请求）
        /// </summary>
        /// <param name="content"></param>
        void DealWithCommonData(byte[] content);

        /// <summary>
        /// 处理数据，主要用于查询生产过程中的工艺数据
        /// </summary>
        /// <param name="content"></param>
        void DealData(byte[] content);

    }


}
